<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增服务路由信息')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-apimapping-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">对外接口名称：</label>
                <div class="col-sm-8">
                    <input name="gatewayApiName" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">对内的接口URL：</label>
                <div class="col-sm-8">
                    <input name="insideApiUrl" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">api状态 1 可用 0 不可用：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_common_status')}">
                        <input type="radio" th:id="${'state_' + dict.dictCode}" name="state" th:value="${dict.dictValue}" th:checked="${dict.default}" required>
                        <label th:for="${'state_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">接口描述：</label>
                <div class="col-sm-8">
                    <textarea name="description" class="form-control"></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">内部微服务名称：</label>
                <div class="col-sm-8">
                    <input name="serviceId" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">幂等性：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_common_status')}">
                        <input type="radio" th:id="${'idempotents_' + dict.dictCode}" name="idempotents" th:value="${dict.dictValue}" th:checked="${dict.default}" required>
                        <label th:for="${'idempotents_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">是否收费：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_common_status')}">
                        <input type="radio" th:id="${'needfee_' + dict.dictCode}" name="needfee" th:value="${dict.dictValue}" th:checked="${dict.default}" required>
                        <label th:for="${'needfee_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "openapiadmin/apimapping"
        $("#form-apimapping-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-apimapping-add').serialize());
            }
        }
    </script>
</body>
</html>